﻿using GalaSoft.MvvmLight.Ioc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfApp_MvvmIoc.Base;
using WpfApp_MvvmIoc.Bll;
using WpfApp_MvvmIoc.Dal;

namespace WpfApp_MvvmIoc.ViewModel;

public class ViewModelCenter
{
    private SimpleIoc simpleIoc = SimpleIoc.Default;

    public ViewModelCenter()
    {
        simpleIoc.Register<MainViewModel>();


        CustomerIoc.RegisterSingle<MainViewModel>();
        CustomerIoc.RegisterSingle<ILogBll, LogBll>();
        CustomerIoc.RegisterSingle<ILogDal, LogDal>();


        MainViewModel mainViewModel = CustomerIoc.GetInstance<MainViewModel>();
        mainViewModel.Value = "12121";
        MainViewModel mainViewModel1 = CustomerIoc.GetInstance<MainViewModel>();
        mainViewModel1.Value = "黄河之水天上来";
    }

    public MainViewModel MainViewModel { get => CustomerIoc.GetInstance<MainViewModel>(); }
}
